import {Helmet} from "react-helmet";

import {Button, message, Space, Upload} from "antd";
import {UploadOutlined} from "@ant-design/icons";

const ImageUpload = () => {
    const props = {
        name: 'file',
        action: 'https://httpbin.org/post',
        onChange(info) {
            if (info.file.status !== 'uploading') {
                console.log(info.file, info.fileList);
            }
            if (info.file.status === 'done') {
                message.success(`${info.file.name} 文件上传成功`);
            } else if (info.file.status === 'error') {
                message.error(`${info.file.name} 文件上传失败`);
            }
        },
    };

    return (
        <Space direction="vertical">
            <Upload {...props}>
                <Button icon={<UploadOutlined />}>上传文件</Button>
            </Upload>
        </Space>
    );
};


export default ImageUpload;